package com.ctshk.app.airexpress.controller;

import com.ctshk.common.annotations.OperationLogAnnotation;
import com.ctshk.common.dto.Result;
import com.ctshk.common.enums.ChannelMainData;
import com.ctshk.common.enums.OperationLogModel;
import com.ctshk.common.enums.OperationLogType;
import com.ctshk.common.enums.SystemError;
import com.ctshk.common.exception.BusinessException;
import com.ctshk.common.model.AppReq;
import com.ctshk.common.web.support.BaseController;
import com.ctshk.rpc.airexpress.dto.app.AirportExpressPCDTO;
import com.ctshk.rpc.airexpress.service.IAirportExpressAppService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.extern.slf4j.Slf4j;
import org.apache.dubbo.config.annotation.DubboReference;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

@Api(value = "机场快线APP服务-PC", tags = "机场快线APP服务-PC")
@RestController
@RequestMapping("/airport/express/pc")
public class AirportExpressPCController extends BaseController {

    @DubboReference
    private IAirportExpressAppService airportExpressAppService;

    @ApiOperation(value = "机场快线APP服务-PC首页", notes = "机场快线APP服务-PC首页")
    @OperationLogAnnotation(operModul = OperationLogModel.TICKET, operType = OperationLogType.QUERY, operTitle = "机场快线APP服务-PC首页", operDesc = "机场快线APP服务-PC首页")
    @GetMapping("/home/list/{channelId}")
    public Result<AirportExpressPCDTO> getPCHomeList(@ApiIgnore AppReq appReq) {
        if (ChannelMainData.isPcById(appReq.getChannelId())) {
            throw new BusinessException(SystemError.AIREXPRESS_50010);
        }
        return airportExpressAppService.getPCHomeList(appReq.getChannelId());
    }
}